package com.chenliang.sc.filter;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: springcase
 * @description:
 * @author: 陈亮
 * @create: 2022-06-09 18:04
 */
@Configuration
@ConditionalOnProperty(
        prefix = "config",
        name = {"filter.open"},
        havingValue = "true",
        matchIfMissing = false
)
public class MyFilter03Config {

    @Bean
    public FilterRegistrationBean<MyFilter03> registerLoginFilter() {
        FilterRegistrationBean<MyFilter03> bean = new FilterRegistrationBean<>();
        bean.setFilter(new MyFilter03());
        bean.setOrder(11);
        bean.addUrlPatterns("/user/*");
        return bean;
    }
    
}
